#!/bin/bash
sum=0
if [ $# -lt 2 ]
then
  echo "请指定两个数值参数"
exit 
fi
num1=$1
num2=$2

if [ "$num1" -eq "$num2" ]
then
  sum=$num1
echo $sum
exit
fi

if [ "$num1" -gt "$num2" ]
then
temp=$num1
num1=$num2
num2=$temp
fi

for((i=$num1;i<=$num2;i++))
do
sum=$[ $sum+$i ]
done

echo "总和为$sum"
